Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Lesson 저장 로직 구현 #17

Closed
wants to merge 15 commits into from
Closed

Conversation

yukudaa
Copy link
Contributor

@yukudaa yukudaa commented Mar 18, 2024

관련 이슈

설명

startedAt, endedAt, record를 요청받아 membership과 함께 lessonRepo에 저장

ingpyo and others added 7 commits March 2, 2024 16:56
* chore: 외부통신을 위한 webflux의존성 추가

* feat: KAKAO API를 통해 메시지를 보내는 기능 구현

* feat: 시스템 시간 정의(Clock)

* chore: firebase의존성 주입

* feat: fcm을 사용해 알람기능 구현

* feat: 이벤트 객체 정의(수업 생성)

* feat: lessonid에 따른 객체 찾는 기능구현

* feat: 이벤트 객체 정의(수업 철회)

* feat: 알람 기능 추상화 밑 스케줄러 기능 구현

* feat: Letter기능 및 알람 메시지 구현

* feat: 오후 **시 **분 형식으로 변경하는 메서드 구현

* feat: 알람기능 구현(수업신청, 수업철회)

* feat: 알람기능의 필요한 스케줄 기능 추가

* chore: DB의존성 추가

* feat:서버가 재시작했을때 알림을 초기화해주는 기능구현

* feat: 알람 확인을 위한 프론트코드 구현

* feat: firebase 설정 추가

* feat: 알람 테스트를 위한 컨트롤러 작성

* feat: 스케쥴러 빈 등록

* feat: Redis를 활용하여 분산된서버일 때 중복으로 알람이 발생하는 문제 해결로직 작성

---------

Co-authored-by: yuseonjun <[email protected]>
private final UserRepository userRepository;

public List<LessonResponse> findMemberShipsById(Long userId) {
List<Lesson> lessons = lessonRepository.findByUserId(userId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final List<Lesson> lessons = lessonRepository.findByUserId(userId);

로 바꾸면 좋을거같아요!

Comment on lines +16 to +17
public List<ProductResponse> findMemberShipsById(Long userId) {
List<Product> products = productRepository.findByUserId(userId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파라미터랑 products에 final 키워드 붙혀주세요

Comment on lines +11 to +12
List<Product> findAll();
List<Product> findByUserId(Long userId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

둘다 없애도될거같아요!
findByUserId는 UserRepository에서 가져오고 findAll은 정의되있어서요..

private final LessonService lessonService;

@PostMapping("/save")
public ResponseEntity<Void> save(final Long userId, @RequestBody LessonResponse lessonResponse) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LessonResponse로 받는 이유가 뭔가요?..
LessonRequest를 정의해서 하는게 좋아보여요

Comment on lines +21 to +22
private ResponseEntity<List<ProductResponse>> findMemberShipsById(@PathVariable Long userId) {
List<ProductResponse> response = productService.findMemberShipsById(userId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final~

Comment on lines 20 to 25
public static LessonResponse from(Lesson lesson) {
return new LessonResponse(lesson.getId(), lesson.getMemberShip(), lesson.getStudent(),
lesson.getTeacher(), lesson.getStartedAt(), lesson.getEndedAt(),lesson.getRecord());
}

public static List<LessonResponse> fromList(List<Lesson> lessons) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final~

Comment on lines +17 to +22
public static ProductResponse from(Product product) {
return new ProductResponse(product.getId(), product.getType(), product.getTeacher(),
product.getCount(), product.getCreatedAt(), product.getUpdatedAt());
}

public static List<ProductResponse> fromList(List<Product> products) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final~

@yukudaa yukudaa changed the title Feat/16 create lesson [Feat] 16 save lesson Mar 27, 2024
@yukudaa yukudaa changed the title [Feat] 16 save lesson [Feat] 16 레쓴 저장 구현 Mar 27, 2024
@yukudaa yukudaa changed the title [Feat] 16 레쓴 저장 구현 [Feat] 레쓴 저장 구현 Mar 27, 2024
@ingpyo ingpyo changed the title [Feat] 레쓴 저장 구현 [Feat] Lesson 저장 로직 구현 Mar 27, 2024
Comment on lines 30 to 29


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

개행 지워주면 좋을거같아요.

private final MemberShipRepository memberShipRepository;

@Transactional
// request 받아서 save 하는 로직
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주석도 지우면 좋을거같아요!

Comment on lines 20 to 14
private final LessonService lessonService;
@PostMapping("/save/{membershipId}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중간에 개행해주세요!

@yukudaa yukudaa force-pushed the feat/16-create-lesson branch from 6c42d00 to 63cbc46 Compare March 27, 2024 05:50

private String record;

public Lesson(Long id, MemberShip memberShip, LocalDateTime startedAt, LocalDateTime endedAt, String record) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정적 팩토리 메서드를 사용하실거면 private로 감추는것도 좋아보여요!

private final LessonService lessonService;

@PostMapping("/save/{membershipId}")
public Long save(final @PathVariable Long membershipId, final @RequestBody LessonRequest lessonRequest) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final을 어노테이션 오른쪽에 놔두면 좋을거 같아요!

LocalDateTime endedAt,
String record
) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

공백을 지우는건 어떨까요?

@ingpyo ingpyo closed this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants